package BuildStepFactory;

# $Id: BuildStepFactory.pm 266 2010-07-18 13:30:59Z dolbanavt $
# $Date: 2010-07-18 16:31:21 +0300 (Вск, 18 Июл 2010) $
# $HeadURL: https://robosearch.googlecode.com/svn/branches/reborn/lib/BuildStepFactory.pm $
# $LastChangedRevision: 292 $

use parent qw( FactoryMethod );
use JIP::ToolSet;
use Carp qw( croak );
use English qw( -no_match_vars );

our $VERSION = '1.0';

sub create {
    my ( $self, $step_name, $step_params ) = @ARG;

    croak 'step_name required'   if not defined $step_name;
    croak 'step_params required' if not defined $step_params;

    return FactoryMethod->_instantiate_class(
        class_name            => 'BuildCommand::'. $step_name,
        constructor_arguments => [ %{ $step_params } ],
        singleton_requested   => 0,
    );
}

1;

__END__

=head1 NAME

BuildStepFactory - фабрика инстанцирующая классы семейства BuildCommand

=head1 SYNOPSIS

    use BuildStepFactory;

    my $s = BuildStepFactory->create( 'StepName', {
        conf => $conf_obj,
        log  => $log_obj,
        dbw  => $db_wrapper,
    } );

=head1 DEPENDENCIES

JIP::ToolSet (from base_lib)

FactoryMethod (from base_lib)

=head1 AUTHOR

Vladimir Zhavoronkov, <dolbanavt (at) Google Mail>

http://dolbanavt.livejournal.com/

=head1 LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

=cut
